package com.itheima.stock.pojo.domain;

import com.github.pagehelper.Page;
import lombok.Data;

import java.util.List;

@Data
public class PageResult {
    /**
     * 总条数
     */
    private Long totalRows;
    /**
     * 总页数
     */
    private int totalPages;
    /**
     * 当前页码
     */
    private int pageNum;
    /**
     * 每页大小
     */
    private int pageSize;
    /**
     * 当前页大小
     */
    private int size;
    /**
     * 当前页数据
     */
    private List<StockUpdownDomain> rows;

    public PageResult(Page<StockUpdownDomain> pageInfo){
        this.setTotalRows(pageInfo.getTotal());
        this.setTotalPages(pageInfo.getPages());
        this.setPageNum(pageInfo.getPageNum());
        this.setPageSize(pageInfo.getPageSize());
        this.setSize(pageInfo.size());
        this.setRows(pageInfo.getResult());
    }

}
